package com.xnyzc.lhy.statistics.mapper.statistics;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xnyzc.lhy.statistics.entity.order.OaCOrderPersonal;
import com.xnyzc.lhy.statistics.entity.param.capacity.CapacityParam;
import com.xnyzc.lhy.statistics.entity.statistics.CollectCapacityStatistical;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 运力统计数据 Mapper 接口
 * </p>
 *
 * @author cuixiaojian
 * @since 2019-11-28
 */
public interface CollectCapacityStatisticalMapper extends BaseMapper<CollectCapacityStatistical> {

    List<OaCOrderPersonal> searchOrder();

    /**
     * 司机数量
     * @return Integer
     */
    Integer queryDriverCount();

    /**
     * 今日出车司机
     * @return Integer
     */
    List<Long> driveOutAccount(CapacityParam capacityParam);

    /**
     * 出车司机2
     */
    Integer driveOutAccountAbstrct(@Param("cityId") String cityId, @Param("driverIds") List<Long> driverIds);

    /**
     * 今日完单司机
     * @return Integer
     */
    List<Integer> orderFulfillmentAccount(CapacityParam capacityParam);

    /**
     * 今日未出车司机
     * @return Integer
     */
    Integer noDrivingOutAccount(CapacityParam capacityParam);

    /**
     * 接驾中司机
     * @return Integer
     */
    Integer pickUpACarAccount(CapacityParam capacityParam);

    /**
     * 服务中司机
     * @return Integer
     */
    Integer serviceAccount(CapacityParam capacityParam);

    List<Map<String, Object>> lineChartGroup();

    /**
     * 应答司机24时制
     * @param timeList
     * @param cityId
     * @return
     */
    List<Map<String, Object>> answerDriverCountTimeLineChart(@Param("timeList") List<Date> timeList, @Param("cityId") String cityId);

    /**
     * 应答司机日制
     * @param timeList
     * @param cityId
     * @return
     */
    List<Map<String, Object>> answerDriverCountDayLineChart(@Param("timeList") List<Date> timeList, @Param("cityId") String cityId);

    /**
     * 出车总时长 日制
     */
    List<Map<String, Object>> getDrivingTimeSumLineChart(@Param("timeList") List<Date> timeList, @Param("cityId") String cityId);

    /**
     * 出车总时长 时制
     */
    List<Map<String, Object>> getDrivingTimeToDaySumLineChart(@Param("timeList") List<Date> timeList, @Param("cityId") String cityId);

    /**
     * 人均出车时长 日制
     * @param timeList
     * @param cityId
     * @return
     */
    List<Map<String, Object>> getDrivingTimeCountLineChart(@Param("timeList") List<Date> timeList, @Param("cityId") String cityId);

    /**
     * 人均出车时长 时制
     * @param timeList
     * @param cityId
     * @return
     */
    List<Map<String, Object>> getDrivingTimeToDayCountLineChart(@Param("timeList") List<Date> timeList, @Param("cityId") String cityId);

    /**
     * 完单司机折线图
     * @param timeList
     * @param cityId
     * @return
     */
    List<Map<String, Object>> orderFulfillmentCountLineChart(@Param("timeList") List<Date> timeList, @Param("cityId") String cityId);

    /**
     * 完单司机折线图
     * @param timeList
     * @param cityId
     * @return
     */
    List<Map<String, Object>> orderFulfillmentToDayCountLineChart(@Param("timeList") List<Date> timeList, @Param("cityId") String cityId);

    /*       ---------------       订单汇总        ------------------    */

    /**
     * 今日订单流水
     * @return
     */
    BigDecimal orderFlow(CapacityParam capacityParam);

    /**
     * 今日乘客发单量
     * @return
     */
    Integer userBillCount(CapacityParam capacityParam);

    /**
     * 今日应答订单量
     * @return
     */
    Integer driverReplyCount(CapacityParam capacityParam);

    /**
     * 今日完成订单量
     * @return
     */
    Integer driverCompleteCount(CapacityParam capacityParam);

    /**
     * 今日应答前乘客其他平台受理订单
     * @return
     */
    Integer priorOtherAcceptance(CapacityParam capacityParam);

    /**
     * 今日应答后其他平台受理订单量
     */
    Integer priorOtherAcceptanceAfter(CapacityParam capacityParam);

    /**
     * 今日统计BY订单状态查询
     * @return
     */
    Integer getOrderSummaryByOrderStatus(@Param("orderStatus") Integer orderStatus, @Param("cityId") String cityId);

    /**
     * 待支付订单量
     * @return
     */
    Integer toBePaid(CapacityParam capacityParam);

    /* ----------------------------------- 订单折线图 ----------------------------------- */

    /**
     * 日制订单流水
     * @param timeList
     * @param cityId
     * @return
     */
    List<Map<String, Object>> orderFlowChart(@Param("timeList") List<Date> timeList, @Param("cityId") String cityId);

    /**
     * 时制订单流水
     * @param timeList
     * @param cityId
     * @return
     */
    List<Map<String, Object>> orderFlowToDayChart(@Param("timeList") List<Date> timeList, @Param("cityId") String cityId);

    /**
     * 日制乘客发单量
     * @param timeList
     * @param cityId
     * @return
     */
    List<Map<String, Object>> userBillCountChart(@Param("timeList") List<Date> timeList, @Param("cityId") String cityId);

    /**
     * 时制乘客发单量
     * @param timeList
     * @param cityId
     * @return
     */
    List<Map<String, Object>> userBillCountToDayChart(@Param("timeList") List<Date> timeList, @Param("cityId") String cityId);

    /**
     * 日制平台应答量
     * @param timeList
     * @param cityId
     * @return
     */
    List<Map<String, Object>> driverReplyCountChart(@Param("timeList") List<Date> timeList, @Param("cityId") String cityId);

    /**
     * 时制平台应答量
     * @param timeList
     * @param cityId
     * @return
     */
    List<Map<String, Object>> driverReplyCountToDayChart(@Param("timeList") List<Date> timeList, @Param("cityId") String cityId);

    /**
     * 日制完成订单量
     * @param timeList
     * @param cityId
     * @return
     */
    List<Map<String, Object>> driverCompleteCountChart(@Param("timeList") List<Date> timeList, @Param("cityId") String cityId);

    /**
     * 时制完成订单量
     * @param timeList
     * @param cityId
     * @return
     */
    List<Map<String, Object>> driverCompleteCountToDayChart(@Param("timeList") List<Date> timeList, @Param("cityId") String cityId);

    /* ----------------------------------- 保存统计 ----------------------------------- */

    List<Map<String, Object>> searchDriveOutCount();

}
